package com.hovhanna.monopoly.model;

import java.util.Random;

import com.hovhanna.monopoly.model.Model.DefaultEvents;

public class Dice extends Model<DefaultEvents> {
    private Die[] dice = new Die[2];
    
    public int roll() {
        int value = 0;
        for (Die die : dice) {
            value += die.roll();
        }
        return value;
    }
    
    public int getValue() {
        return dice[0].getValue() + dice[1].getValue();
    }
    
    public boolean isEven() {
        return dice[0].getValue() == dice[1].getValue();
    }
    
    private static class Die {
        private Random random = new Random();
        private int value = 1;
        
        public int roll() {
            value = random.nextInt(6) + 1;
            return value;
        }
        
        public int getValue() {
            return value;
        }
    }
}
